home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / PowerMacInterface / scrap.icl < prev    next >
Encoding:
Modula Implementation  |  1997-01-15  |  1.8 KB  |  54 lines  |  [TEXT/3PRM]

  1. implementation module scrap;
  2.  
  3. import    StdArray;
  4. import    mac_types;
  5.  
  6. NoScrapErr            :==    -100;            // desk scrap isn't initialized
  7. NoTypeErr            :==    -102;            // no data of the requested type
  8.  
  9. ScrapSize            :==    2400;            // $960 (Long)        size in bytes of desk scrap
  10. ScrapHandle            :==    2404;            // $964 (Long)        handle to desk scrap in memory
  11. ScrapCount            :==    2408;            // $968 (Word)        count changed by ZeroScrap
  12. ScrapState            :==    2410;            // $96A (Word)        tells where desk scrap is
  13. ScrapName            :==    2412;            // $96C (String256)    pointer to scrap filename (preceded by length byte)
  14.  
  15. TextResourceType    :== 0x54455854;        // 'TEXT'
  16. PictResourceType    :== 0x50494354;        // 'PICT'
  17.  
  18.  
  19. PutScrapText :: !{#Char} !Toolbox -> (!Int,!Toolbox);
  20. PutScrapText sourceText tb = PutScrapText1 (size sourceText) TextResourceType sourceText tb;
  21.  
  22. PutScrapText1 :: !Int !Int !{#Char} !Toolbox -> (!Int,!Toolbox);
  23. PutScrapText1 length theType sourceText tb = code (length=D0,theType=D1,sourceText=U,tb=U)(r=D0,z=Z){
  24.     instruction 0x38B70008    |    addi    r5,r23,8
  25.     call    .PutScrap
  26. }
  27. /*
  28. PutScrap :: !{#Char} !Int !Int -> Int;
  29. PutScrap string resource_type t = code (string=U,resource_type=D1,t=U)(r=D0){
  30.     instruction 0x38B70008    |    addi    r5,r23,8
  31.     instruction 0x80770004    |    lwz        r3,4(r23)
  32.     call    .PutScrap
  33. }
  34. */
  35.  
  36. //    Previous type: ZeroScrap :: Int;
  37. //    No name conversion
  38. ZeroScrap :: !Toolbox -> (!Int,!Toolbox);
  39. ZeroScrap tb = code (tb=U)(r=D0,z=Z){
  40.     call    .ZeroScrap
  41. }
  42.  
  43. //    Previous type: GetScrap :: !Handle !Int -> (!Int,!Int,!Toolbox);
  44. //    No name conversion
  45. GetScrap :: !Handle !Int !Toolbox -> (!Int,!Int,!Toolbox);
  46. GetScrap handle resource_type tb = code (handle=D0,resource_type=R4O0D2D1,tb=U)(r=D0,offset=L,t=Z){
  47.     call    .GetScrap
  48. }
  49.  
  50. PutScrap :: !Int !Int !Ptr !Toolbox -> (!Int,!Toolbox);
  51. PutScrap length theType source tb = code (length=D0,theType=D1,source=D3,tb=U)(r=D0,z=Z){
  52.     call    .PutScrap
  53. };
  54.